<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta content="text/html;charset=UTF-8">
	<title>比康医箱</title>
	

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link href="../static/css/bootstrap.min.css" rel="stylesheet" media="screen" />
<link rel="stylesheet" href="../static/css/font-awesome.min.css" />
<link rel="stylesheet" href="../static/css/app.css" id="maincss">
<link rel="stylesheet" type="text/css" href="../static/css/button.css">
<link rel="stylesheet" type="text/css" href="../static/css/dialog.css">
<link rel="stylesheet" type="text/css" href="../static/css/pagination.css">
<link rel="stylesheet" type="text/css" href="../static/css/common-style.css">
<script type="text/javascript">
	var path = '';		
</script>
<script src="../static/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.validator.min.js"></script>
<script type="text/javascript" src="../static/js/zh-CN.js"></script>
<script src="../static/js/jquery.cookie.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.storageapi.js"></script>
<script  type="text/javascript" src="../static/js/app.js"></script>
<script src="../static/js/common.js"></script>
<script src="../static/js/common-getInfo.js"></script>
<script src="../static/js/common-validate.js"></script>
<script src="../static/js/common-util.js"></script>
<script src="../static/js/common-dataBind.js"></script>
<script src="../static/js/jquery.PrintArea.js"></script>
<script language="javascript" type="text/javascript">
/**获取是否在客户端标志
 * sessionStorage 根据打开浏览器时获取参数*/
function getKeHudbz() {
	var keHudURL =$('#mainIframe').context.referrer;
	function getValue(url, name) {
	    var reg = new RegExp('(\\?|&)' + name + '=([^&?]*)', 'i');
	    var arr = url.match(reg);
	    if (arr) {
	        return arr[2];
	    }
	    return null;
	}
	var where = getValue(keHudURL, 'where');
	if (where != null) {
		if(where == "Q8gmoUGvFHpoSA43EVyVkg==") {
			sessionStorage.setItem('isKeHud', true);
		} else {
			sessionStorage.setItem('isKeHud', false);
		}
	} 
	if (sessionStorage.getItem('isKeHud') == 'true'){
		return true;
	} else if (sessionStorage.getItem('isKeHud') == 'false') {
		return false;;
	}
}
// 客户端标志
var isKeHud = getKeHudbz();
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : (s = ua
		.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] : (s = ua
		.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] : (s = ua
		.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] : (s = ua
		.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
		
//以下进行测试
/* if (Sys.chrome) {
	//document.write('Chrome: ' + Sys.chrome.substr(0,2));
	//目前Chrome浏览器需要判断支持情况
	var banBenHao = Sys.chrome.substr(0, 2);
	if (parseInt(banBenHao) >= 40) {
		//版本号大于53,跳转到登录页
	} else {
		//版本号小于53,跳转到支持页
		window.location.href="/jump/toZhichi"; 
	}
}
if(!Sys.safari&&!Sys.chrome){
	//其他浏览器，都不支持
	window.location.href="/jump/toZhichi"; 
} */
</script>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
	</head>
	<body>
	<input id="yb-init" style="display: none" value=""/>
	</body>
</html>

	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="../static/css/common-fs.css">
	<link rel="stylesheet" type="text/css" href="../static/css/button.css">
	<link rel="stylesheet" href="../static/css/chuangjianzs.css">
	<link rel="stylesheet" type="text/css" href="../static/css/header.css">
	<link rel="stylesheet" type="text/css" href="../static/css/loading.css"></head>
<body>
	<div  id="loading" style="position: absolute;top: 40%;left: 50%;" >
        <div class="loader-demo">
           <div class="ball-spin-fade-loader">
              <div></div>
              <div></div>
              <div></div>
              <div></div>
              <div></div>
              <div></div>
              <div></div>
              <div></div>
           </div>
        </div>
     </div>
	<SCRIPT language=javascript>
	function closeDiv()
	{
		document.getElementById('loading').style.display='none';
	}
	</SCRIPT>
		<header class="header clearfix">
				<div class="h-container" style="float:left;margin:0;">
					<img src="../static/image/bk_logox.png" alt="logo" class="h-logo">
					
					<span class="g-cloudclinic" style="vertical-align: middle;">比康医箱</span>
				</div>
				<div class="h-help-ect">
	              <div class="h-doctor my-message" id="m-message" style="margin-right:0; border-bottom:solid 4px #097c25;">
	              		<span id="helloworld" style="color:#fff;">1357...</span> 
	              		<i class="fa fa-caret-right fa-lg" aria-hidden="true" style="color:#fff;"></i>
	              		<ul class="pull-down-list">
	              			<li><a href="toZhanghaoxxDl.jsp?flag=3">帐户信息</a></li>
	              			 
	              			<li><a href="../yonghu/tuichu">退出</a></li>
	              		</ul>
	              </div>
	            </div>
		</header>
						
	 <div class="g-container  main-scroll-nav">
		
	   <div class="g-main" style="padding-top:55px;">
	   		<form class="form form-horizontal" role="form" id="addinfo" onsubmit="return false" method="post">
	   			<div class="g-msg"><div class="msg-box" id="msg_holder"></div></div>
				<div class="my-clinic message-title">
					<b></b>
					<span class="b-title">创建诊所</span>
					
				</div>
				<div class="mycc-main clearfix">
					<div class="mycc-photo">					
        				<div id="crop-avatar">
							<div class="avatar-view" data-toggle="tooltip" data-placement="bottom" title="更换诊所logo功能，正在完善中...">
			    				<img id="imgid" src="../static/image/logo-100x100.jpg" alt="Logo">
			    			</div>
						</div>
    					
						<div>诊所图片</div>
					</div>
					<div class="g-form-group">
					
						
						<div class="g-shield">
							    <label class="g-label-name"><span class="glyph-star">*</span>诊所名称：</label>
							    <input type="text" class="g-input g-input-name form-control" data-target="#msg_holder" placeholder="请输入诊所名称" name="mingcheng">
						    </div>
							<div class="g-shield g-radio-shield" style="padding-top:10px;">   
							    <label class="g-label-name" ><span class="glyph-star">*</span>类型：</label>
								<input type="radio" id="chinese" name="leixing" data-rule="checked" data-target="#msg_holder" value="1" checked="checked">
  								<label name="chinese" class="checked radio-label on" id="chinese-label" for="chinese">&nbsp;&nbsp;中西医门诊</label>
  								<input type="radio" id="europe" name="leixing" value="2" data-rule="checked" data-target="#msg_holder" >
  								<label name="europe" for="europe" id="europe-label" class="radio-label">&nbsp;&nbsp;中医门诊</label>
  								<input type="radio" id="oral" name="leixing" value="3" data-rule="checked" data-target="#msg_holder">
  								<label name="oral" for="oral" class="radio-label" id="oral-label">&nbsp;&nbsp;口腔门诊</label>
							 </div>
							 <div class="g-shield">
							    <label class="g-label-name">地址：</label>
								<div class="city-picker ">
							      <!-- 暂无 港澳台 如需要可在city.json文件中添加-->
							      <input type="hidden" class="provinceIn">
							      <input type="text" name="shengfen" id="province" class="dropdown-zsxx"  placeholder="请选择您所在省份">
							　　　　<ul id="provinceUl" class="dropdown-zsxxul dropdown-province"><li id="choosePro"  style="display:none" value="-1"></li></ul>
							    </div>
							    <div class="city-picker ">
							      <input type="hidden" class="cityIn">
							      <input id="citys" name="chengshi"  class="dropdown-zsxx" onchange=""  placeholder="请选择您所在城市">
							        <ul id="cityUl" class="dropdown-zsxxul dropdown-city"><li id='chooseCity' style="display:none" value='-1'></li></ul>
							    </div>
							    <div class="city-picker ">
							      <input type="hidden" class="countyIn ">
							      <input id="county" name="quxian"  class="dropdown-zsxx" placeholder="请选择您所在区/县">
							          <ul id="countyUl" class="dropdown-zsxxul dropdown-county"><li id='chooseCounty' style="display:none" value='-1'></li></ul>
							    </div>
							</div>
							<div class="g-shield">
							    <label class="g-label-name">详细地址：</label>
							    <input type="text" class="g-input g-input-name form-control" data-rule="详细地址: length(0~100)" data-target="#msg_holder" placeholder="" name="dizhi">
							</div>
							<!--医疗机构编号 -->
							</div>
					<input type="hidden" name="qianming" id="qianming">
					<div class="g-form-button button-center">
	 			 		<button class="btn btn-success button"id="baocunbtn">保存</button> 
	 			 		<div class="btn btn-default button button1" onclick="quxiao()" type="button">取消</div>
	 				</div>
				
				</div>
				<div class="ccinfo-main clearfix">
					<div class="mycc-photo"></div>
						<div class="g-form-group ">	
						</div>
				</div>
				
			</form>
			
		</div>
	</div>
	<!-- <footer class="footer">
			<div class="copyright"> &#169; 2017杭州比康信息科技有限公司
	</footer> -->
	<script type="text/javascript" src="../static/js/zhensuoxx-citypicker.js"></script>
	<script src="../static/js/ajaxfileupload.js"></script>
	<script type="text/javascript">
	closeDiv();//缓冲页面不显示
	var path =  '';
	function ajaxFileUpload() { 
		$.ajaxFileUpload( {
			url : '../upload/doUpload',//用于文件上传的服务器端请求地址  
	        secureuri : false,//一般设置为false  
	        fileElementId : 'avatarInput',//文件上传控件的id属性  
	        dataType : 'text',
	        success : function(data){ //服务器成功响应处理函数
	         	var start = data.indexOf("{");
	         	var end = data.indexOf("}");
				data = data.substring(start,end+1);
				var dataset = $.parseJSON(data);
				$('#imgid').attr('src',path+'/download/doTempDownload?filepath='+dataset.filepath);            		
        		}
		
		});
		return false;  
	}
		
		//获取签名
$(function(){
	$.ajax({
		url:path+'/base/getQianming',
		type:'POST',
		success:function(data) {
			$('#qianming').val(data);
			}
		});
	});
	
$(function(){
$(".radio-label").on("click",function(){
	  $(this).addClass("on").siblings().removeClass("on");
	});
});
//保存按钮
$('#baocunbtn').click(function(){
	$('#addinfo').validator({
	fields: {
		'mingcheng':'诊所名称:required;length(1~32)',
		'leixing':'checked',
		'yiliaojgbh': 'length(1~20)'
	},
	valid: function(form){
		$('#baocunbtn').attr('disabled','true');
		$.ajax({
			type:"post",
			url:path+"/zhensuo/chuangjianzs",
			 beforeSend: function () {
				$("#loading").css({"display":"block","z-index":"5"});
			  },
			 complete: function () {
			    $("#loading").css({"display":"none","z-index":"5"});
			 },
			data:$('#addinfo').serializeArray(),
			success:function(data){
				if(data!=null){
					triggerTongzhifs();
					var sjc=new Date().getTime();
					var msg=encodeURI(encodeURI('创建诊所成功'));
		  			window.location.href=path+'/zhensuo/toZhensuoIndex?id='+data+'&jinrusj='+sjc + '&type=yongyou&rukou=0';
		  			return false; 
				}
			}	
		});
	}
});
});
	$("#m-message").mouseover(function(){
        	$("#m-message i").removeClass("fa-caret-right").addClass("fa-caret-down");
        }).mouseout(function(){
        	$("#m-message i").removeClass("fa-caret-down").addClass("fa-caret-right");
        });

function quxiao(){
	window.location.href='toXuanzezs.jsp';
}
	</script>
</body>
</html>


